<template>
  <div id="main" style="width: 650px; height: 600px;"></div>
</template>

<script>

import * as echarts from 'echarts'

export default {
  name: "Echarts2",
  data() {
    return{

    }
  },
  mounted() {  //页面元素渲染之后触发

    // 圆角环形图
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option = {
      title: {
        text: '历年商家信用统计',
        left: 'center',
        textStyle: {
          fontsize: 50
        }
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '5%',
        left: 'center'
      },
      series: [
        {
          type: 'pie',
          radius: ['40%', '70%'],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 10,
            borderColor: '#fff',
            borderWidth: 2
          },
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '40',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [] //填空
        }
      ]
    };

    this.request.get("/echarts/members2").then(res =>{
      option.series[0].data = [
        {name: "受到行政处罚单位", value: res.data[0]},
        {name: "经营异常单位", value: res.data[1]},
        {name: "严重失信单位", value: res.data[2]},
      ]
      myChart.setOption(option);
    })

  }
}
</script>

<style scoped>

</style>